package com.案例;

import java.util.Scanner;

public class Demo01 {

    public static void main(String[] args) {
        String username = "路韶聪";
        String password = "123";

        for (int i = 0; i < 3; i++) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入账号");
            String name = scanner.next();

            System.out.println("请输入密码");
            String pwd = scanner.next();


            if (name.equals(username) && pwd.equals(password)) {
                System.out.println("成功");
                break;
            } else {
                System.out.println("失败 " + "你还有" + (2 - i) + "次机会");

            }
        }

    }
}
